package com.sen.controller;


import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.sen.common.api.ApiResult;
import com.sen.model.entity.BmsPost;
import com.sen.model.entity.BmsTag;
import com.sen.model.vo.PostVO;
import com.sen.service.BmsPostService;
import com.sen.service.BmsTagService;
import org.springframework.util.Assert;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.HashMap;
import java.util.Map;

/**
 *
 *
 * @author ergou
 * @since 2021-04-12
 */
@RestController
@RequestMapping("/search")
public class BmsSearchController {
    @Resource
    private BmsPostService postService;

    @GetMapping
    public ApiResult<Page<PostVO>> searchList(@RequestParam("keyword") String keyword,
                                              @RequestParam("pageNum") Integer pageNum,
                                              @RequestParam("pageSize") Integer pageSize) {
        Page<PostVO> results = postService.searchByKey(keyword, new Page<>(pageNum, pageSize));
        return ApiResult.success(results);
    }
}
